$OpenBSD: patch-network_c,v 1.2 2015/06/19 16:34:41 sthen Exp $
--- network.c.orig	Tue Jun 16 02:20:11 2015
+++ network.c	Tue Jun 16 02:20:42 2015
@@ -271,11 +271,9 @@ void udp_xmit (struct buffer *buf, struct tunnel *t)
     memset(&msgh, 0, sizeof(struct msghdr));
 
     msgh.msg_control = cbuf;
-    msgh.msg_controllen = 0;
+    msgh.msg_controllen = sizeof(cbuf);
 
     if(gconfig.ipsecsaref && t->refhim != IPSEC_SAREF_NULL) {
-	msgh.msg_controllen = sizeof(cbuf);
-
 	cmsg = CMSG_FIRSTHDR(&msgh);
 	cmsg->cmsg_level = IPPROTO_IP;
 	cmsg->cmsg_type  = gconfig.sarefnum;
@@ -581,7 +579,6 @@ void network_thread ()
                 {
                     /* Got some payload to send */
                     int result;
-                    recycle_payload (buf, sc->container->peer);
 /*
 #ifdef DEBUG_FLOW_MORE
                     l2tp_log (LOG_DEBUG, "%s: rws = %d, pSs = %d, pLr = %d\n",
@@ -602,13 +599,12 @@ void network_thread ()
 						sc->dethrottle = schedule(tv, dethrottle, sc); 					
 					} else */
 /*					while ((result=read_packet(buf,sc->fd,sc->frame & SYNC_FRAMING))>0) { */
-                    while ((result =
-                            read_packet (buf, sc->fd, SYNC_FRAMING)) > 0)
+                    while ((result = read_packet (sc)) > 0)
                     {
-                        add_payload_hdr (sc->container, sc, buf);
+                        add_payload_hdr (sc->container, sc, sc->ppp_buf);
                         if (gconfig.packet_dump)
                         {
-                            do_packet_dump (buf);
+                            do_packet_dump (sc->ppp_buf);
                         }
 
 
@@ -618,10 +614,10 @@ void network_thread ()
                             deschedule (sc->zlb_xmit);
                             sc->zlb_xmit = NULL;
                         }
-                        sc->tx_bytes += buf->len;
+                        sc->tx_bytes += sc->ppp_buf->len;
                         sc->tx_pkts++;
-                        udp_xmit (buf, st);
-                        recycle_payload (buf, sc->container->peer);
+                        udp_xmit (sc->ppp_buf, st);
+                        recycle_payload (sc->ppp_buf, sc->container->peer);
                     }
                     if (result != 0)
                     {
